package com.yequan.thread.base.volatilepackage;

public class Run2 {

    public static void main(String[] args) {

        final VolatileFeatureClass2 volatileFeatureClass2=new VolatileFeatureClass2();

        Thread ta=new Thread(new Runnable() {
            @Override
            public void run() {
                volatileFeatureClass2.set(10L);
            }
        });

        Thread tb=new Thread(new Runnable() {
            @Override
            public void run() {
                volatileFeatureClass2.getAndIncrement();
            }
        });

        Thread tc=new Thread(new Runnable() {
            @Override
            public void run() {
                long l = volatileFeatureClass2.get();
                System.out.println(l);
            }
        });

        ta.start();
        tb.start();
        tc.start();
    }

}
